﻿using System;
using UnityEngine;

namespace UniRx.Diagnostics
{
	// Token: 0x020003B4 RID: 948
	public class Logger
	{
		// Token: 0x0600136A RID: 4970 RVA: 0x00058955 File Offset: 0x00056D55
		public Logger(string loggerName)
		{
			this.Name = loggerName;
			this.logPublisher = ObservableLogger.RegisterLogger(this);
		}

		// Token: 0x17000157 RID: 343
		// (get) Token: 0x0600136B RID: 4971 RVA: 0x00058970 File Offset: 0x00056D70
		// (set) Token: 0x0600136C RID: 4972 RVA: 0x00058978 File Offset: 0x00056D78
		public string Name { get; private set; }

		// Token: 0x0600136D RID: 4973 RVA: 0x00058984 File Offset: 0x00056D84
		public virtual void Debug(object message, UnityEngine.Object context = null)
		{
			if (!Logger.isInitialized)
			{
				Logger.isInitialized = true;
				Logger.isDebugBuild = UnityEngine.Debug.isDebugBuild;
			}
			if (Logger.isDebugBuild)
			{
				Action<LogEntry> action = this.logPublisher;
				string message2 = (message == null) ? string.Empty : message.ToString();
				action(new LogEntry(this.Name, LogType.Log, DateTime.Now, message2, context, null, null, null));
			}
		}

		// Token: 0x0600136E RID: 4974 RVA: 0x000589F0 File Offset: 0x00056DF0
		public virtual void DebugFormat(string format, params object[] args)
		{
			if (!Logger.isInitialized)
			{
				Logger.isInitialized = true;
				Logger.isDebugBuild = UnityEngine.Debug.isDebugBuild;
			}
			if (Logger.isDebugBuild)
			{
				Action<LogEntry> action = this.logPublisher;
				string message = (format == null) ? string.Empty : string.Format(format, args);
				action(new LogEntry(this.Name, LogType.Log, DateTime.Now, message, null, null, null, null));
			}
		}

		// Token: 0x0600136F RID: 4975 RVA: 0x00058A5C File Offset: 0x00056E5C
		public virtual void Log(object message, UnityEngine.Object context = null)
		{
			Action<LogEntry> action = this.logPublisher;
			string message2 = (message == null) ? string.Empty : message.ToString();
			action(new LogEntry(this.Name, LogType.Log, DateTime.Now, message2, context, null, null, null));
		}

		// Token: 0x06001370 RID: 4976 RVA: 0x00058AA4 File Offset: 0x00056EA4
		public virtual void LogFormat(string format, params object[] args)
		{
			Action<LogEntry> action = this.logPublisher;
			string message = (format == null) ? string.Empty : string.Format(format, args);
			action(new LogEntry(this.Name, LogType.Log, DateTime.Now, message, null, null, null, null));
		}

		// Token: 0x06001371 RID: 4977 RVA: 0x00058AEC File Offset: 0x00056EEC
		public virtual void Warning(object message, UnityEngine.Object context = null)
		{
			Action<LogEntry> action = this.logPublisher;
			string message2 = (message == null) ? string.Empty : message.ToString();
			action(new LogEntry(this.Name, LogType.Warning, DateTime.Now, message2, context, null, null, null));
		}

		// Token: 0x06001372 RID: 4978 RVA: 0x00058B34 File Offset: 0x00056F34
		public virtual void WarningFormat(string format, params object[] args)
		{
			Action<LogEntry> action = this.logPublisher;
			string message = (format == null) ? string.Empty : string.Format(format, args);
			action(new LogEntry(this.Name, LogType.Warning, DateTime.Now, message, null, null, null, null));
		}

		// Token: 0x06001373 RID: 4979 RVA: 0x00058B7C File Offset: 0x00056F7C
		public virtual void Error(object message, UnityEngine.Object context = null)
		{
			Action<LogEntry> action = this.logPublisher;
			string message2 = (message == null) ? string.Empty : message.ToString();
			action(new LogEntry(this.Name, LogType.Error, DateTime.Now, message2, context, null, null, null));
		}

		// Token: 0x06001374 RID: 4980 RVA: 0x00058BC4 File Offset: 0x00056FC4
		public virtual void ErrorFormat(string format, params object[] args)
		{
			Action<LogEntry> action = this.logPublisher;
			string message = (format == null) ? string.Empty : string.Format(format, args);
			action(new LogEntry(this.Name, LogType.Error, DateTime.Now, message, null, null, null, null));
		}

		// Token: 0x06001375 RID: 4981 RVA: 0x00058C0C File Offset: 0x0005700C
		public virtual void Exception(Exception exception, UnityEngine.Object context = null)
		{
			Action<LogEntry> action = this.logPublisher;
			string message = (exception == null) ? string.Empty : exception.ToString();
			action(new LogEntry(this.Name, LogType.Exception, DateTime.Now, message, context, exception, null, null));
		}

		// Token: 0x06001376 RID: 4982 RVA: 0x00058C51 File Offset: 0x00057051
		public virtual void Raw(LogEntry logEntry)
		{
			this.logPublisher(logEntry);
		}

		// Token: 0x04000B74 RID: 2932
		private static bool isInitialized;

		// Token: 0x04000B75 RID: 2933
		private static bool isDebugBuild;

		// Token: 0x04000B77 RID: 2935
		protected readonly Action<LogEntry> logPublisher;
	}
}
